using System;using System.Data;using System.Data.SqlClient;using System.Collections.Generic;namespace MyWeb.Data{	public class MemberDAL : SqlDataProvider	{		#region[Member_GetById]		public List<Member> Member_GetById(string Id)		{			var list = new List<Data.Member>();			using (var dbCmd = new SqlCommand("sp_Member_GetById", GetConnection()))			{				Member obj = new Data.Member();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", Id));				var dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.MemberIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[Member_GetByTop]		public List<Member> Member_GetByTop(string Top, string Where, string Order)		{			List<Data.Member> list = new List<Data.Member>();			using (SqlCommand dbCmd = new SqlCommand("sp_Member_GetByTop", GetConnection()))			{				Data.Member obj = new Data.Member();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Top", Top));				dbCmd.Parameters.Add(new SqlParameter("@Where", Where));				dbCmd.Parameters.Add(new SqlParameter("@Order", Order));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.MemberIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[Member_GetByAll]		public List<Member> Member_GetByAll(string Lang)		{			List<Data.Member> list = new List<Data.Member>();			using (SqlCommand dbCmd = new SqlCommand("sp_Member_GetByAll", GetConnection()))			{				Data.Member obj = new Data.Member();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.MemberIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[Member_Paging]		public List<Member> Member_Paging(string CurentPage, string PageSize, string Lang)		{			List<Data.Member> list = new List<Data.Member>();			using (SqlCommand dbCmd = new SqlCommand("sp_Member_Paging", GetConnection()))			{				Data.Member obj = new Data.Member();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@CurentPage", CurentPage));				dbCmd.Parameters.Add(new SqlParameter("@PageSize", PageSize));				dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.MemberIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}		return list;		}		#endregion		#region[Member_Insert]		public bool Member_Insert(Member data)		{			using (SqlCommand dbCmd = new SqlCommand("sp_Member_Insert", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Username", data.Username));				dbCmd.Parameters.Add(new SqlParameter("@Password", data.Password));				dbCmd.Parameters.Add(new SqlParameter("@Name", data.Name));				dbCmd.Parameters.Add(new SqlParameter("@Birthday", data.Birthday));				dbCmd.Parameters.Add(new SqlParameter("@Genrder", data.Genrder));				dbCmd.Parameters.Add(new SqlParameter("@Email", data.Email));				dbCmd.Parameters.Add(new SqlParameter("@Phone", data.Phone));				dbCmd.Parameters.Add(new SqlParameter("@Adress", data.Adress));				dbCmd.Parameters.Add(new SqlParameter("@CreateDate", data.CreateDate));				dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));				dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("Member");			return true;		}		#endregion		#region[Member_Update]		public bool Member_Update(Member data)		{			using (SqlCommand dbCmd = new SqlCommand("sp_Member_Update", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", data.Id));				dbCmd.Parameters.Add(new SqlParameter("@Username", data.Username));				dbCmd.Parameters.Add(new SqlParameter("@Password", data.Password));				dbCmd.Parameters.Add(new SqlParameter("@Name", data.Name));				dbCmd.Parameters.Add(new SqlParameter("@Birthday", data.Birthday));				dbCmd.Parameters.Add(new SqlParameter("@Genrder", data.Genrder));				dbCmd.Parameters.Add(new SqlParameter("@Email", data.Email));				dbCmd.Parameters.Add(new SqlParameter("@Phone", data.Phone));				dbCmd.Parameters.Add(new SqlParameter("@Adress", data.Adress));				dbCmd.Parameters.Add(new SqlParameter("@CreateDate", data.CreateDate));				dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));				dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("Member");			return true;		}		#endregion		#region[Member_Delete]		public bool Member_Delete(string Id)		{			using (SqlCommand dbCmd = new SqlCommand("sp_Member_Delete", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", Id));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("Member");			return true;		}		#endregion			}}